package testing.comparer;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;

import comparer.AWLComparer;

import words.AWL;
import words.Types;

import checker.SingleChecker;


public class AWLComparerTest {
	AWLComparer comparer;
	AWL origin_awl;
	AWL compared_awl;
	@Before
	public void setUp() throws Exception {
		this.comparer = new AWLComparer();
		this.origin_awl = new AWL();
		this.compared_awl = new AWL();
	}
	@Test
	public void test1()
	{
		String origin1 = "advocate";
		String compare1 = "advocate";
		origin_awl.input(origin1);
		compared_awl.input(compare1);
		comparer.set_origin(origin_awl);
		comparer.set_compared(compared_awl);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test2()
	{
		String origin1 = "advocate";
		String compare1 = "advocates";
		origin_awl.input(origin1);
		compared_awl.input(compare1);
		comparer.set_origin(origin_awl);
		comparer.set_compared(compared_awl);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,0);
	}
	@Test
	public void test3()
	{
		String origin1 = "advocate";
		String origin2 = "common";
		String compare1 = "advocate";
		String compare2 = "common";
		origin_awl.input(origin1);
		origin_awl.input(origin2);
		compared_awl.input(compare1);
		compared_awl.input(compare2);
		comparer.set_origin(origin_awl);
		comparer.set_compared(compared_awl);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,2);
	}
	@Test
	public void test4()
	{
		String origin1 = "advocate";
		String origin2 = "common";
		String compare1 = "advocates";
		String compare2 = "common";
		origin_awl.input(origin1);
		origin_awl.input(origin2);
		compared_awl.input(compare1);
		compared_awl.input(compare2);
		comparer.set_origin(origin_awl);
		comparer.set_compared(compared_awl);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test5()
	{
		String origin1 = "advocates";
		String origin2 = "common";
		String compare1 = "advocate";
		String compare2 = "commoned";
		origin_awl.input(origin1);
		origin_awl.input(origin2);
		compared_awl.input(compare1);
		compared_awl.input(compare2);
		comparer.set_origin(origin_awl);
		comparer.set_compared(compared_awl);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,0);
	}
}
